//
// Created by YE on 2024/1/3.
//

#ifndef YCH_INTERPRETER_YCH_H
#define YCH_INTERPRETER_YCH_H


#include <climits>
#include <string>
#include <stack>
#include <fstream>
#include <list>
#include <vector>
#include <sstream>
#include <unordered_map>
#include <csetjmp>
#include <cmath>
#include <cstring>
#include <iostream>
#if defined(LLONG_MAX)
#define YCH_INT long long
#define YCH_FLOAT double
#define YCH_STRING std::string
#define YCH_INT_FORMAT "%ld"
#define YCH_FLOAT_FORMAT "%lf"
#else
#define YCH_INT int
#define YCH_FLOAT float

#define YCH_INT_FORMAT "%d"
#define YCH_FLOAT_FORMAT "%f"
#endif
#define YCH_ERROR(s) std::cout<<"YCH_INTERPRETER ERROR:"<<s<<std::endl;

#define YCH_INTERPRETER_STATE_LEXER 1
#define YCH_INTERPRETER_STATE_PARSER 2
#define YCH_INTERPRETER_STATE_ICG 3

#define print(s) std::cout<<s<<std::endl

//ERROR
#define YCH_MEMORY_ERROR 11
#define YCH_READER_ERROR 12
#define YCH_LEXER_ERROR 13
#define YCH_PARSER_ERROR 14

#define YCH_ERROR_STATE unsigned int
//YCH_CODE
#define YCH_STATE unsigned int

#define YCH_NO 0
#define YCH_OK 1

#define YCH_VM_INSTRUCTION_SIZE (1024*16)
#define YCH_VM_I_START 0
#define YCH_VM_FUNC_START (1024*10)

#define YCH_VM_REGISTER_SIZE 8
#define YCH_VM_MEM_SIZE (1024*2)

#define YCH_VM_INT_CONST_SIZE 256
#define YCH_VM_FLOAT_CONST_SIZE 256
#define YCH_VM_STR_CONST_SIZE 32
#define YCH_VM_STACK_SIZE (1024*4)
#define YCH_VM_C_FUNC_SIZE 16

#endif //YCH_INTERPRETER_YCH_H
